#ifndef __VIEWPORT_H
#define __VIEWPORT_H

#include "sprite.h"
#include "gamedata.h"

class Viewport {
	public:
		static Viewport& getInstance();
		void update();
		void setObjExploded();

		float X() const { return position[0]; }
		void X(float x) { position[0] = x; }
		float Y() const { return position[1]; }
		void Y(float y) { position[1] = y; }

		void setObjectToTrack(const Sprite *obj);
		const Sprite* getObjectToTrack() const { return objectToTrack; } 
		void freeze() { frozen = true; }
		void draw() const;
		unsigned getViewWidth(){return viewWidth;}
		unsigned getViewHeight(){return viewHeight;}

	private:
		bool frozen;
		const Gamedata& gdata;
		Vector2f position;
		unsigned viewWidth;
		unsigned viewHeight;
		unsigned worldWidth;
		unsigned worldHeight;
		Uint16 objWidth;
		Uint16 objHeight;
		int objX;

		const Sprite *objectToTrack;
		const Frame *const crosshairFrame;

		Viewport();
		Viewport(const Viewport&);
		Viewport& operator=(const Viewport&);
};

#endif // !__VIEWPORT_H
